/*
 * @Author: wangjq4214
 * @Date: 2022-05-03 16:21:41
 * @LastEditTime: 2022-05-03 22:33:23
 * @LastEditors: wangjq4214
 */
import { FC, PropsWithChildren } from 'react';
import { tokenAtom } from '@/models/global';

const Auth: FC<PropsWithChildren<unknown>> = ({ children }) => {
  const token = useAtomValue(tokenAtom);
  if (token === '') {
    return <Navigate to={'/login'} />;
  }
  return <>{children}</>;
};

export default Auth;
